package com.bndg.blackjack.services

import com.xuhao.didi.core.iocore.interfaces.ISendable
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.nio.charset.Charset


/**
 * Created by Tony on 2017/10/24.
 */
class MsgDataBean(content: String) : ISendable {
    private var content = ""

    init {
        this.content = content
    }

    override fun parse(): ByteArray {
        val body = content.toByteArray(Charset.defaultCharset())
        val bb = ByteBuffer.allocate(4 + body.size)
        bb.order(ByteOrder.BIG_ENDIAN)
        bb.putInt(body.size)
        bb.put(body)
        return bb.array()
    }
}
